import { Entity, Column } from 'typeorm';
import { BaseEntity } from '../../../common/base.entity';

@Entity('base_sys_menu', { schema: 'midway-admin' })
export class BaseSysMenu extends BaseEntity {
  @Column('int', { name: 'pid', nullable: true, comment: '父菜单ID' })
  pid: number | null;

  @Column('varchar', { name: 'title', comment: '菜单名称', length: 255 })
  title: string;

  @Column('varchar', { name: 'name', comment: '路由名称', length: 255 })
  name: string;

  @Column('varchar', {
    name: 'router',
    nullable: true,
    comment: '菜单地址',
    length: 255,
  })
  router: string | null;
  
  @Column('varchar', {
    name: 'activeMenu',
    nullable: true,
    comment: '高亮菜单',
    length: 255,
  })
  activeMenu: string | null;

  @Column('text', { name: 'permission', nullable: true, comment: '权限标识' })
  perms: string | null;

  @Column('int', {
    name: 'type',
    comment: '类型 0-目录 1-菜单 2-按钮',
    default: 0,
  })
  type: number;

  @Column('varchar', {
    name: 'icon',
    nullable: true,
    comment: '图标',
    length: 255,
  })
  icon: string | null;

  @Column('int', { name: 'sort', comment: '排序', default: 0 })
  sort: number;

  @Column('varchar', {
    name: 'path',
    nullable: true,
    comment: '视图地址',
    length: 255,
  })
  path: string | null;

  @Column('boolean', {
    name: 'keepAlive',
    comment: '路由缓存',
    default: false,
  })
  keepAlive: number;

  @Column('boolean', {
    name: 'hidden',
    comment: '是否显示',
    default: false,
  })
  hidden: number;

  @Column('boolean', {
    name: 'noCache',
    comment: '是否缓存',
    default: false,
  })
  noCache: number;

  @Column('boolean', {
    name: 'affix',
    comment: '标签固定',
    default: false,
  })
  affix: number;

  @Column('boolean', {
    name: 'openMore',
    comment: '支持多开',
    default: false,
  })
  openMore: number;
  
  @Column('boolean', {
    name: 'checkHome',
    comment: '是否为首页',
    default: false,
  })
  checkHome: number;
}
